#阶乘函数
def factorial(num):
    if num == 1:
        return 1
    else:
        return num * factorial(num - 1)
#调用函数
num = 5
print(f"{num}的阶乘是：", factorial(num))
print()


#2.汉诺塔问题
def hanoi(n, a, b, c):
    if n == 1:
        print(a, '->', c)
    else:
        hanoi(n - 1, a, c, b)
        print(a, '->', c)
        hanoi(n - 1, b, a, c)


hanoi(3, 'A', 'B', 'C')
